import React, { memo } from "react";
import css from './css.module.scss'
import { useHistory } from 'react-router-dom';
import { openUrl } from '../../common/utils'
import { Empty } from 'antd';
import { NO_DATA_TEXT } from '../../services/config'
export default memo(function HYReportList(props) {
    const history = useHistory();
    const { list = [] } = props

    const handDetails = (item) => {
        //返回true可以跳转详情 
        if (openUrl(item)) {
            history.push('/newsDetails?newsId=' + item.newsId);
        }
    }
    return (
        <div className={css.report_list}>
            {list.length !== 0 ?
                list.map(item => {
                    return (
                        <div key={item.newsId} className={css.item} onClick={e => handDetails(item)}>
                            <div className={css.title}>
                                {item.title}
                            </div>
                            <div className={css.time}>
                                {item.updateTime}
                            </div>
                        </div>
                    )
                })
                : <Empty description={NO_DATA_TEXT} />}

        </div>
    )
})
